package snafu.gui;

import java.util.Observable;
import java.util.Observer;

import javax.swing.JLabel;
import javax.swing.JPanel;

import snafu.controller.Processor;
import snafu.controller.WorldController;

public class InformationPanel extends JPanel implements Observer {
	private Processor processor;
	private JLabel roundLabel;

	public InformationPanel(WorldController controller) {
		processor = controller.getProcessor();

		roundLabel = new JLabel();
		add(roundLabel);

		update(null, null);
	}

	@Override
	public void update(Observable o, Object arg) {
		String roundString = "round: " + processor.getCurrentRound() + "/"
				+ (processor.getMaxRounds() == Processor.INFINITY ? "∞" : processor.getMaxRounds());
		roundLabel.setText(roundString);
	}
}
